////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	MathPlane3D.h
//  MathLib
//
//  Created by Gregory Maks on 8/14/09.
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef MATH_PLANE3D_H
#define MATH_PLANE3D_H

#include "MathDefines.h"


// Predefinitions
struct Vector4;
struct QuadPoly3D;


// Enums
typedef enum
{
	PlaneClassification_Intersects = 0,
	PlaneClassification_Back = -1,
	PlaneClassification_Front = 1
} PlaneClassification;


/// 3D Plane
/// Represented by a normal to a plane, and distance from the O point along this normal
struct Plane3D
{
	Vector4 normal;		///< normal vector to plane
	floatType distance;		///< dist component (Also the inverse dot product between normal and point)
	
	
public:
	void ctor();
	
	Plane3D ();
	Plane3D (const Plane3D &aPlane);
	Plane3D (Vector4 &aNormal, floatType aDistance);
	//Plane3D (Vector4 aPt1, Vector4 *aPt2, Vector4 *aPt3);
	

	void Normalize();
	
	floatType GetSignedDistance (Vector4 &aPoint);
	
	/// Gets the rect position versus current plane.
	PlaneClassification GetPointVsPlaneClassification (Vector4 &aPoint);
	PlaneClassification GetRectVsPlaneClassification (Rect3D &aRect);
	PlaneClassification GetQuadVsPlaneClassification (QuadPoly3D &aRect);
};



#endif //MATH_PLANE3D_H
